﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="fleetdetail.ascx.cs" Inherits="fleetdetail" %>


<asp:ListView ID="ListView2" runat="server" DataSourceID="SqlDataSource1">
    <AlternatingItemTemplate>
        <span style="background-color: #151613;">
        Fleet Name:
        <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
        <br />
        TotalRevenue:
        <asp:Label ID="TotalRevenueLabel" runat="server" 
            Text='<%# Eval("TotalRevenue") %>' />
        <br />
        Town:
        <asp:Label ID="TownLabel" runat="server" Text='<%# Eval("Town") %>' />
        <br />
        <br />
        </span>
    </AlternatingItemTemplate>
    <EditItemTemplate>
        <span style="background-color: #008A8C;color: #FFFFFF;">Name:
        <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
        <br />
        TotalRevenue:
        <asp:TextBox ID="TotalRevenueTextBox" runat="server" 
            Text='<%# Bind("TotalRevenue") %>' />
        <br />
        Town:
        <asp:TextBox ID="TownTextBox" runat="server" Text='<%# Bind("Town") %>' />
        <br />
        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
            Text="Update" />
        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
            Text="Cancel" />
        <br />
        <br />
        </span>
    </EditItemTemplate>
    <EmptyDataTemplate>
        <span>No fleet found.</span>
    </EmptyDataTemplate>
    <InsertItemTemplate>
        <span style="">Name:
        <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
        <br />
        TotalRevenue:
        <asp:TextBox ID="TotalRevenueTextBox" runat="server" 
            Text='<%# Bind("TotalRevenue") %>' />
        <br />
        Town:
        <asp:TextBox ID="TownTextBox" runat="server" Text='<%# Bind("Town") %>' />
        <br />
        <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
            Text="Insert" />
        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
            Text="Clear" />
        <br />
        <br />
        </span>
    </InsertItemTemplate>
    <ItemTemplate>
    <table width="600px">
    <tr>
        <td align="left" valign="top">
            <span class="fdgen">
        
                <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>'  CssClass="fdmid"/>
                <br />
               <%-- 
                Town:
                <asp:Label ID="TownLabel" runat="server" Text='<%# Eval("Town") %>' />
                --%>
                <br />
                <br />                
                <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>' CssClass="fdbig"/>
            </span>
        </td>
        <td  align="right">
        <a href="images/fleet/<%# Eval("ID") %>.jpg" class="thickbox">
            <img src="images/fleet/<%# Eval("ID") %>.jpg" class="fdimg" alt='<%# Eval("Name") %>'/>
        </a> 
        </td>
    </tr>
    <tr>
    <td colspan="2">
        <span style="background-color: #151613;color: #F0F0F0; font-size:16px;">
        <br />
        Slogan:
        </span>
        <br />
        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Slogan") %>' />
        <br />
        <br />
        <br />
        <span style="background-color: #151613;color: #F0F0F0; font-size:16px;">
        Address:
        </span>
        <br />
        <asp:Label ID="Label2" runat="server" Text='<%# Eval("Address") %>' />

    </td>
    
    </tr>
    </table>

    </ItemTemplate>
    <LayoutTemplate>
        <div style="font-family: Verdana, Arial, Helvetica, sans-serif;" 
            ID="itemPlaceholderContainer" runat="server">
            <span runat="server" id="itemPlaceholder" />
        </div>
        <div style="text-align: center;background-color: #151613;font-family: Verdana, Arial, Helvetica, sans-serif;color: #F0F0F0;">
        </div>
    </LayoutTemplate>
    <SelectedItemTemplate>
        <span style="background-color: #008A8C;font-weight: bold;color: #FFFFFF;">Name:
        <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
        <br />
        TotalRevenue:
        <asp:Label ID="TotalRevenueLabel" runat="server" 
            Text='<%# Eval("TotalRevenue") %>' />
        <br />
        Town:
        <asp:Label ID="TownLabel" runat="server" Text='<%# Eval("Town") %>' />
        <br />
        <br />
        </span>
    </SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:conn %>" 
    
    
    SelectCommand="SELECT dbo.Fleet.Name, dbo.Fleet.TotalRevenue, dbo.Town.Name AS Town, dbo.Fleet.Phone, dbo.Fleet.Slogan, dbo.Fleet.Address, dbo.Fleet.ID FROM dbo.Town INNER JOIN dbo.Fleet INNER JOIN dbo.ConnectionFleetTown ON dbo.Fleet.ID = dbo.ConnectionFleetTown.FleetID ON dbo.Town.TownID = dbo.ConnectionFleetTown.TownID WHERE (dbo.ConnectionFleetTown.TownID = @TownID)">
    <SelectParameters>
        <asp:QueryStringParameter DefaultValue="1" Name="TownID" 
            QueryStringField="Fleet" />
    </SelectParameters>
</asp:SqlDataSource>

<br />
<br />
<br />
<span style="background-color: #151613;color: #F0F0F0; font-size:16px;">Our Taxies</span>
<br />
<br />

<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource2" 
    GroupItemCount="3">
    <AlternatingItemTemplate>
        <td id="Td1" runat="server" style="background-color: #151613; color: #F0F0F0; border-color:Yellow;" border="1">
            <b>Plate No:</b>
            <asp:Label ID="PlateNoLabel" runat="server" Text='<%# Eval("PlateNo") %>' />
            <br />
            <b>Daily Km:</b>
            <asp:Label ID="DailyKmLabel" runat="server" Text='<%# Eval("DailyKm") %>' />
            <br />
            <b>Total Km:</b>
            <asp:Label ID="TotalKmLabel" runat="server" Text='<%# Eval("TotalKm") %>' />
            <br />
            <b>Revenue:</b>
            <asp:Label ID="RevenueLabel" runat="server" Text='<%# Eval("Revenue") %>' />
            <br />
            <b>Available:</b>
            <asp:Label ID="AvailableLabel" runat="server" Text='<%# Eval("Available") %>' />
            <br />
            <asp:Label ID="DayNightLabel" runat="server" Text='<%# ((bool)Eval("DayNight"))? "Night":"Day" %>' />
            <br />
            <b>Name:</b>
            <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
            <br />
            <b>Driver:</b>
            <a href='driverdetail.aspx?Detail=<%# Eval("DriverUserName") %>&height=220&width=600' class="thickbox">
            <asp:Label ID="DriverUserNameLabel" runat="server" 
                Text='<%# Profile.GetProfile(Eval("DriverUserName").ToString()).FirstName + " " +Profile.GetProfile(Eval("DriverUserName").ToString()).LastName %>'></asp:Label>
            </a>
            <br />
        </td>
    </AlternatingItemTemplate>
    <EditItemTemplate>
        <td runat="server" style="background-color: #FFCC66;color: #000080;">
            PlateNo:
            <asp:TextBox ID="PlateNoTextBox" runat="server" Text='<%# Bind("PlateNo") %>' />
            <br />
            DailyKm:
            <asp:TextBox ID="DailyKmTextBox" runat="server" 
                Text='<%# Bind("DailyKm") %>' />
            <br />
            TotalKm:
            <asp:TextBox ID="TotalKmTextBox" runat="server" Text='<%# Bind("TotalKm") %>' />
            <br />
            Revenue:
            <asp:TextBox ID="RevenueTextBox" runat="server" Text='<%# Bind("Revenue") %>' />
            <br />
            Available:
            <asp:TextBox ID="AvailableTextBox" runat="server" 
                Text='<%# Bind("Available") %>' />
            <br />
            <asp:CheckBox ID="DayNightCheckBox" runat="server" 
                Checked='<%# Bind("DayNight") %>' Text="DayNight" />
            <br />
            Name:
            <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
            <br />
            DriverUserName:
            <asp:TextBox ID="DriverUserNameTextBox" runat="server" 
                Text='<%# Bind("DriverUserName") %>' />
            <br />
            <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                Text="Update" />
            <br />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Cancel" />
            <br />
        </td>
    </EditItemTemplate>
    <EmptyDataTemplate>
        <table runat="server" 
            
            style="background-color: #FFFFFF; border-collapse: collapse;border-color: #999999; border-style:none;border-width:1px;">
            <tr>
                <td>
                    No fleet found.</td>
            </tr>
        </table>
    </EmptyDataTemplate>
    <EmptyItemTemplate>
        <td runat="server"/>
    </EmptyItemTemplate>
    <GroupTemplate>
        <tr ID="itemPlaceholderContainer" runat="server">
            <td ID="itemPlaceholder" runat="server">
            </td>
        </tr>
    </GroupTemplate>
    <InsertItemTemplate>
        <td runat="server" style="">
            PlateNo:
            <asp:TextBox ID="PlateNoTextBox" runat="server" Text='<%# Bind("PlateNo") %>' />
            <br />
            DailyKm:
            <asp:TextBox ID="DailyKmTextBox" runat="server" 
                Text='<%# Bind("DailyKm") %>' />
            <br />
            TotalKm:
            <asp:TextBox ID="TotalKmTextBox" runat="server" Text='<%# Bind("TotalKm") %>' />
            <br />
            Revenue:
            <asp:TextBox ID="RevenueTextBox" runat="server" Text='<%# Bind("Revenue") %>' />
            <br />
            Available:
            <asp:TextBox ID="AvailableTextBox" runat="server" 
                Text='<%# Bind("Available") %>' />
            <br />
            <asp:CheckBox ID="DayNightCheckBox" runat="server" 
                Checked='<%# Bind("DayNight") %>' Text="DayNight" />
            <br />
            Name:
            <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
            <br />
            DriverUserName:
            <asp:TextBox ID="DriverUserNameTextBox" runat="server" 
                Text='<%# Bind("DriverUserName") %>' />
            <br />
            <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                Text="Insert" />
            <br />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Clear" />
            <br />
        </td>
    </InsertItemTemplate>
    <ItemTemplate>
                <td id="Td1" runat="server" style="background-color: #151613; color: #F0F0F0; border-color:Yellow;" border="1">
            <b>Plate No:</b>
            <asp:Label ID="PlateNoLabel" runat="server" Text='<%# Eval("PlateNo") %>' />
            <br />
            <b>Daily Km:</b>
            <asp:Label ID="DailyKmLabel" runat="server" Text='<%# Eval("DailyKm") %>' />
            <br />
            <b>Total Km:</b>
            <asp:Label ID="TotalKmLabel" runat="server" Text='<%# Eval("TotalKm") %>' />
            <br />
            <b>Revenue:</b>
            <asp:Label ID="RevenueLabel" runat="server" Text='<%# Eval("Revenue") %>' />
            <br />
            <b>Available:</b>
            <asp:Label ID="AvailableLabel" runat="server" Text='<%# Eval("Available") %>' />
            <br />
            <b>Works:</b>
            <asp:Label ID="DayNightLabel" runat="server" Text='<%# ((bool)Eval("DayNight"))? "Night":"Day" %>' />
            <br />
            <b>Name:</b>
            <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
            <br />
            <b>Driver:</b>
             <a href='driverdetail.aspx?Detail=<%# Eval("DriverUserName") %>&height=220&width=600' class="thickbox">
            <asp:Label ID="DriverUserNameLabel" runat="server" 
                Text='<%# Profile.GetProfile(Eval("DriverUserName").ToString()).FirstName + " " +Profile.GetProfile(Eval("DriverUserName").ToString()).LastName %>'></asp:Label>
            </a>
            <br />
        </td>
    </ItemTemplate>
    <LayoutTemplate>
        <table runat="server">
            <tr runat="server">
                <td runat="server">
                    <table ID="groupPlaceholderContainer" runat="server" border="1"                        
                        style="border-color: #FFF000; border-width: 0px; background-color: #151613; font-family: Verdana, Arial, Helvetica, sans-serif; border-collapse: collapse;">
                        <tr ID="groupPlaceholder" runat="server">
                        </tr>
                    </table>
                </td>
            </tr>
            <tr runat="server">
                <td runat="server" 
                    
                    style="text-align: Right;background-color: #151613; font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFF000;">
                    <asp:DataPager ID="DataPager1" runat="server" PageSize="4">
                        <Fields>
                           <%-- <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                ShowNextPageButton="False" ShowPreviousPageButton="False" />--%>
                            <asp:NumericPagerField />
                            <%--<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                ShowNextPageButton="False" ShowPreviousPageButton="False" />--%>
                        </Fields>
                    </asp:DataPager>
                </td>
            </tr>
        </table>
    </LayoutTemplate>
    <SelectedItemTemplate>
        <td runat="server" 
            style="background-color: #FFCC66;font-weight: bold;color: #000080;">
            PlateNo:
            <asp:Label ID="PlateNoLabel" runat="server" Text='<%# Eval("PlateNo") %>' />
            <br />
            DailyKm:
            <asp:Label ID="DailyKmLabel" runat="server" Text='<%# Eval("DailyKm") %>' />
            <br />
            TotalKm:
            <asp:Label ID="TotalKmLabel" runat="server" Text='<%# Eval("TotalKm") %>' />
            <br />
            Revenue:
            <asp:Label ID="RevenueLabel" runat="server" Text='<%# Eval("Revenue") %>' />
            <br />
            Available:
            <asp:Label ID="AvailableLabel" runat="server" Text='<%# Eval("Available") %>' />
            <br />
            <asp:CheckBox ID="DayNightCheckBox" runat="server" 
                Checked='<%# Eval("DayNight") %>' Enabled="false" Text="DayNight" />
            <br />
            Name:
            <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
            <br />
            DriverUserName:
            <asp:Label ID="DriverUserNameLabel" runat="server" 
                Text='<%# Eval("DriverUserName") %>' />
            <br />
        </td>
    </SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:conn %>" 
    
    SelectCommand="SELECT dbo.Taxi.PlateNo, dbo.Taxi.DailyKm, dbo.Taxi.TotalKm, dbo.Taxi.Revenue, dbo.Taxi.Available, dbo.Taxi.DayNight, dbo.Town.Name, dbo.Taxi.DriverUserName FROM dbo.ConnectionTaxiFleet INNER JOIN dbo.Taxi ON dbo.ConnectionTaxiFleet.TaxiID = dbo.Taxi.ID INNER JOIN dbo.Town ON dbo.Taxi.CurrentLocation = dbo.Town.TownID WHERE (dbo.ConnectionTaxiFleet.FleetID = @Fleet)">
    <SelectParameters>
        <asp:QueryStringParameter DefaultValue="1" Name="Fleet" 
            QueryStringField="Fleet" />
    </SelectParameters>
</asp:SqlDataSource>


